<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.cvs.pojo.Resume" %>

<%--
  Created by IntelliJ IDEA.
  User: 李俊
  Date: 2022/9/16
  Time: 10:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>$Title$</title>
    <style>
        tr:nth-child(odd) {
            background-color: slategrey;
        }

        a {
            text-decoration: none;
        }
    </style>
</head>
<body>
<div>
    <h1>个人简历信息列表</h1>
    <div align="center">
        <form action="ResumeSelectAndViewSexServlet">
            性别 <input type="radio" name="view" id="view1" value="1">男 <input type="radio" name="view" id="view2"
                                                                                value="2">女
            <input type="radio" name="view" value="0" id="view3">全部
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="查询">
            <button><a href="./ResumeInsert.jsp">新增个人简历信息</a></button>
        </form>
    </div>
    <table border="1">
        <tr>
            <td>姓名</td>
            <td>姓别</td>
            <td>出生日期</td>
            <td>出生时间</td>
            <td>联系电话</td>
            <td>毕业学校</td>
            <td>简历状态</td>
            <td>操作</td>
        </tr>
        <c:forEach var="Resome" items="${requestScope.list}">
            <tr>
                <td>${Resome.userName}</td>
                <td>${Resome.sex}</td>
                <td>${Resome.address}</td>
                <td>${Resome.birth}</td>
                <td>${Resome.telephone}</td>
                <td>${Resome.school}</td>
                <td>${Resome.status==0?"保密":"公开"}</td>
                <td><a href="javascript:void(0)" onclick="deteResume(${Resome.id})">删除</a></td>
            </tr>
        </c:forEach>
    </table>
</div>`  n
</body>
</html>
<script src="js/jquery-1.8.3.min.js"></script>
<script>
    if (${requestScope.view==1}) {
        $("#view1").attr("checked", "checked");
    }
    if (${requestScope.view==2}) {
        $("#view2").attr("checked", "checked")
    }
    if (${requestScope.view==0}) {
        $("#view3").attr("checked", "checked")
    }

    function deteResume(id) {
        if (confirm("确定删除吗？")) {
            $.post("ResumeDeleteServlet", "id=" + id, function (data) {
                if (data == "true") {
                    alert("删除成功")
                } else {
                    alert("删除失败")
                }
            }, "text");
        }
    }
</script>

